<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <ui:define name="content"> 
        <f:view beforePhase="#{grouponManagerBean.initViewGroupon}"/>   
        <h:form id="mainForm">
            <h1>Review groupon details</h1>
            <p:fieldset style="width:950px">

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:messages />
                <h:panelGrid columns="2" columnClasses="column" cellpadding="5">
                    <h:panelGrid columns="2" border="1" columnClasses="column" cellpadding="5">

                        <h:outputText value="Groupon Name" style="font-weight:bold; text-align:center; font-size:12px" />
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.name}" />

                        <h:outputText value="Original Price" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.originalPrice} SGD"/>

                        <h:outputText value="Offered Price" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.offeredPrice} SGD"/>

                        <h:outputText value="Proposed Commission" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.percentCommissionSetByStakeholder}%"/>

                        <h:outputText value="Commission Required By TCube" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.percentCommissionSetByTCube}%"/>

                        <h:outputText value="Minimum Issued Quantity" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.minimumIssuedQuantity}"/>

                        <h:outputText value="Maximum Issued Quantity" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.maximumIssuedQuantity}"/>

                        <h:outputText value="Start Selling Date" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.startDate}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="End Selling Date" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.endDate}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="Groupons Valid From" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.startValidDate}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="Groupons Valid Until" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.endValidDate}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="Status" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.status}"/>

                        <h:outputText value="Quantity Bought" style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.quantityBought}"/>

                    </h:panelGrid>

                    <p:graphicImage id="imageDisplay" value="/images/upload/media/#{grouponManagerBean.selectedGroupon.groupon.imageURL}"
                                    height="300" width="450"/> 

                </h:panelGrid>

                <p:separator />
                <br/>

                <p:fieldset legend="Highlights" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.highlights}" escape="false"/>
                </p:fieldset>
                <br/>
                <p:fieldset legend="Fine Print" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.fineprint}" escape="false"/>
                </p:fieldset>
                <br/>
                <p:fieldset legend="Description" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:panelGrid columns="1" cellpadding="10">
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.name}" style="font-weight:bold; text-align:center; font-size:14px"/>
                        <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.description}" escape="false"/>
                    </h:panelGrid>
                </p:fieldset>
                <br/>
                <p:fieldset legend="Remarks from TCube" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">

                    <h:outputText value="#{grouponManagerBean.selectedGroupon.groupon.remarkFromTCube}" escape="false"/>

                </p:fieldset>

                <h:panelGrid columns="2" columnClasses="column" cellpadding="5">
                    <p:commandButton id="back" value="Back" ajax="true" action="stakeholder/StakeholderViewOfferedGroupons?faces-redirect=true"/>
                    <p:commandButton id="viewPurchase" value="View Purchase Information" ajax="true" actionListener="#{grouponManagerBean.stakeholderViewGrouponPurchaseInformation}"/>
                </h:panelGrid> 

            </p:fieldset>
        </h:form>
    </ui:define>
</ui:composition>
